﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using BOL;
using BOL.CentroCosto;
using UtilityExtensions;
using System.Web.Script.Services;
using System.Web.Services;

namespace UILGestion
{
    public partial class WebForm8 : System.Web.UI.Page
    {

        
        [WebMethod(),ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static List<CuentaSearchInfo>  GetCuentaConf(String prefixText)
        {
            CuentaConfBL bol = new CuentaConfBL();
            var w = bol.GetCuentaConfSearch(prefixText, 6, 20);
            //var result = Util.Tbl2Str(Util.EntidadToDataTable(w.ToList()));
            return w.ToList();

        }


        [WebMethod(), ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static List<AnexoSearchInfo> GetAnexo(String prefixText)
        {
            //contextKey valor Chkval
            var d = prefixText.Split('|');

            CuentaConfBL bol = new CuentaConfBL();

            var w = bol.GetAnexoSearch(d[0], d[1].ToInt(), d[2], 20);

            return w.ToList();

        }

        [WebMethod(), ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static List<CentroCostoSearchInfo> GetCentroCosto(String prefixText, String contextKey)
        {
            CentroCostoBL bol = new CentroCostoBL();
            var w = bol.GetCentroCostoSearch(prefixText, 6, 20);

            return w.ToList();

        }

        
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}